package com.pubg.information.serviceImpl;

import com.pubg.information.bean.Members;
import com.pubg.information.mapper.MemberMapper;
import com.pubg.information.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl implements LoginService {
    @Autowired(required=false)
    MemberMapper memberMapper;

    @Override
    public void register(String account, String password, String name) {
        memberMapper.insMember(account,password,name);
    }

    @Override
    public Boolean login(String account,String password) {

        String password1 = memberMapper.getPasswordByAccount(account);
        if (password1.equals(password)){
            return true;
        }else{
            return false;
        }
    }

    @Override
    public String getNameByAccount(String account) {
        return memberMapper.getNameByAccount(account);
    }
}
